$ = jQuery.noConflict();


function addCategaryWindowDisp()
{
  $('#basicModalContent').modal(
  {
    close:true,onShow: function (dialog)
    {
    }
  });
  $("#saveBtn").live("click",function()
  {
    addCategaryWindow($("#categoryId").val());
  });
  $("#cancelBtn").live("click",function()
  {
    cancelModel();
  });  
}

function DispAddSubCategaryWindow()
{
  $('#basicModalContentSub').modal(
  {
    close:true,onShow: function (dialog)
    {
    }
  });
  $("#saveBtn1").live("click",function()
  {
    addSubCategaryWindow($("#subCategoryId").val());
  });
  $("#cancelBtn1").live("click",function()
  {
    cancelModel();
  });  
}

function addCategaryWindow(categoryId)
{
  var categoryName = document.categoryAdd.categoryName.value;
  $.ajax(
  {
    type:"POST",
    url:'categoryAdd.php',
    data:
    {
      categoryName :document.categoryAdd.categoryName.value
    },
    success: function(data)
    {
      $('#categoryId').val(data);
      $.modal.close();
    }
  });
}

function addSubCategaryWindow(subCategoryId)
{
  var categoryId      = document.subCategoryAdd.categoryId.value;
  var subCategoryName = document.subCategoryAdd.subCategoryName.value;
  $.ajax(
  {
    type:"POST",
    url:'subCategoryAdd.php',
    data:
    {
      categoryId :document.subCategoryAdd.categoryId.value,
      subCategoryName :document.subCategoryAdd.categoryName.value
    },
    success: function(data)
    {
      $('#subCategory').val(data);
      $.modal.close();
    }
  });
}

function cancelModel()
{
  $.modal.close();
}